#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		int n;
		cin >> n;
		int a[20000], b[20000], c[20000];
		int x = 0, y = 0;
		for (int j = 0; j < n; j++) {
			scanf("%d", &a[j]);
			if (a[j] % 2 == 0) {
				b[x] = j;
				x++;
			}
		}
		int arr[200000];
		for (int j = 0; j < n; j++) {
			arr[j] = a[j];
		}
		sort(arr, arr + n);
		for (int j = 0; j < n; j++) {
			if (arr[j] % 2 == 0) {
				c[y] = j;
				y++;
			}
		}
		bool m = true;
		if (x != y)
			m = false;
		for (int j = 0; j < n; j++) {
			if (b[j] != c[j]) {
				m = false;
				break;
			}
		}
		if (m)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}